﻿///////////////////////////////////////////////////////////////////////////////
//
// This file is part of the BassDrop project
//   https://code.google.com/p/bass-drop/
//
//
// Creator:	Gergely Krajcsovszki (krajcsovszkig@hotmail.com)
// Date:	2014-03-30 16:45
//
//
// Copyright © 2013-2014. Gergely Krajcsovszki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BassDrop.Core.Common.Cloud
{
	/// <summary>
	/// Class containing the account information for a cloud connection
	/// </summary>
	public class AccountInfo
	{
		/// <summary>
		/// The name of the user having this account
		/// </summary>
		public string UserName
		{
			get;
			private set;
		}

		/// <summary>
		/// The e-mail address this account is registered with
		/// </summary>
		public string UserEmail
		{
			get;
			private set;
		}

		/// <summary>
		/// The amount of data this account can hold in bytes
		/// </summary>
		public long QuotaBytes
		{
			get;
			private set;
		}

		/// <summary>
		/// The amount of data in this account in bytes
		/// </summary>
		public long UsedBytes
		{
			get;
			private set;
		}

		/// <summary>
		/// The ratio of the quota used up in percents
		/// </summary>
		public double UsedPercent
		{
			get
			{
				return ((double) UsedBytes / (double) QuotaBytes) * 100.0;
			}
		}

		/// <summary>
		/// The amount of free space in this account in bytes
		/// </summary>
		public long FreeBytes
		{
			get
			{
				return QuotaBytes - UsedBytes;
			}
		}

		/// <summary>
		/// Constructs a new account info object
		/// </summary>
		/// <param name="userName">The name of the user having this account</param>
		/// <param name="userEmail">The e-mail address this account is registered with</param>
		/// <param name="quotaBytes">The amount of data this account can hold in bytes</param>
		/// <param name="usedBytes">The amount of data in this account in bytes</param>
		public AccountInfo( string userName, string userEmail, long quotaBytes, long usedBytes )
		{
			UserName = userName;
			UserEmail = userEmail;
			QuotaBytes = quotaBytes;
			UsedBytes = usedBytes;
		}
	}
}
